from selenium.webdriver.common.by import By

from base import Base

class Page(Base):
    # 步骤一
    # 点击搜索框
    def sou1(self):
        loc=(By.XPATH,'//android.widget.ViewSwitcher[@resource-id="com.achievo.vipshop:id/index_search_custom_hint"]/android.widget.RelativeLayout')
        ele=self.find_ele_wait(loc)
        return ele
    # 步骤二
    # 输入耳机
    def sou2(self):
        loc=(By.CLASS_NAME,'android.widget.EditText')
        ele=self.find_ele(loc)
        return ele
    # 步骤三
    # 点击搜索按钮
    def sou3(self):
        loc=(By.ID,'com.achievo.vipshop:id/tv_search')
        ele=self.find_ele(loc)
        return ele
    # 步骤四
    # 点击图片
    def tu1(self):
        loc=(By.ANDROID_UIAUTOMATOR,'new UiSelector().resourceId("com.achievo.vipshop:id/bottom_icon_layout").instance(0)')
        ele=self.find_ele(loc)
        return ele
    # 步骤五
    # 选择香芋紫颜色
    def yanse(self):
        loc=(By.XPATH,'//android.widget.TextView[@resource-id="com.achievo.vipshop:id/goods_title" and @text="香芋紫"]')
        ele=self.find_ele(loc)
        return ele
    # 步骤六
    # 点击收藏
    def shochang(self):
        loc=(By.ID,'com.achievo.vipshop:id/img')
        ele=self.find_ele(loc)
        return ele
    # 耳机断言
    def eduanyan(self):
        loc=(By.XPATH,'//android.widget.TextView[@resource-id="com.achievo.vipshop:id/gallery_switch_text" and @text="图片"]')
        ele=self.find_ele(loc)
        return ele
    # 冲锋衣断言
    def cduanyan(self):
        loc=(By.XPATH,'//android.widget.TextView[@resource-id="com.achievo.vipshop:id/gallery_switch_text" and @text="评价"]')
        ele=self.find_ele(loc)
        return ele